<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>02</title>
  </head>
  <body>
    <div id="app">
      <input type="text" id="txt" />
      <p></p>
    </div>
    <script src="./js/vue.js"></script>
    <script>
      const txt = document.querySelector('#txt')
      const p = document.querySelector('P')
      const obj = {}
      let result
      Object.defineProperty(obj, 'msg', {
        get() {
          console.log(1)
          return result
        },
        set(val) {
          console.log(2)
          result = val
          p.innerText = result
        },
      })
      txt.addEventListener('input', function () {
        obj.msg = this.value
      })
      console.log(obj);
    </script>
  </body>
</html>
